Skip to content

chore(ibis): add v3 metadata API and remove v2 Oracle test#1369

Closed
goldmedal wants to merge 2 commits intoCanner:mainfrom
goldmedal:chore/refactor-oracle-test
Closed

chore(ibis): add v3 metadata API and remove v2 Oracle test#1369
goldmedal wants to merge 2 commits intoCanner:mainfrom
goldmedal:chore/refactor-oracle-test

Conversation

@goldmedal
Copy link
Copy Markdown
Contributor

@goldmedal goldmedal commented Nov 13, 2025

Summary by CodeRabbit

  • New Features

    • Added three v3 API endpoints for metadata operations: retrieve table lists with schema details, query database constraints, and fetch database version from connected data sources.
  • Tests

    • Added test coverage validating the new v3 metadata endpoints (tables, constraints, version).
    • Removed the legacy v2 Oracle connector test suite.

@github-actions github-actions bot added ibis python Pull requests that update Python code labels Nov 13, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 13, 2025

Walkthrough

Three new v3 metadata endpoints were added to the connector router for retrieving table lists, database constraints, and database version. The Oracle v2 connector test suite file was removed and three v3 Oracle metadata tests were added.

Changes

Cohort / File(s) Summary
V3 connector — new metadata endpoints
ibis-server/app/routers/v3/connector.py
Added POST endpoints /\{data_source\}/metadata/tables, /\{data_source\}/metadata/constraints, and /\{data_source\}/metadata/version. Each builds connection info, creates a tracing span with headers, obtains a Metadata via MetadataFactory, and calls the corresponding timeout-wrapped executor. (Note: duplicate definitions appear in the file — verify.)
Removed v2 Oracle tests
ibis-server/tests/routers/v2/connector/test_oracle.py
Entire file deleted, removing the Oracle v2 connector test suite including fixtures, manifests, container setup, query tests, metadata tests, and model-substitution tests.
Added v3 Oracle metadata tests
ibis-server/tests/routers/v3/connector/oracle/test_query.py
Added test_metadata_list_tables, test_metadata_list_constraints, and test_metadata_db_version validating table metadata, constraint listing, and DB version retrieval via the new v3 endpoints.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Client
    participant V3Endpoint as V3 Metadata Endpoint
    participant Factory as MetadataFactory
    participant Executor as Timeout Executor
    participant DB as Database

    Client->>V3Endpoint: POST /{data_source}/metadata/tables (connectionInfo, dto)
    activate V3Endpoint
    V3Endpoint->>V3Endpoint: start tracing span\nattach headers
    V3Endpoint->>Factory: request Metadata instance
    activate Factory
    Factory->>DB: connect / initialize
    Factory-->>V3Endpoint: Metadata instance
    deactivate Factory
    V3Endpoint->>Executor: execute_get_table_list_with_timeout()
    activate Executor
    Executor->>DB: fetch table metadata
    Executor-->>V3Endpoint: return list[Table]
    deactivate Executor
    V3Endpoint-->>Client: 200 OK + payload
    deactivate V3Endpoint
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check for and remove unintended duplicate endpoint definitions in ibis-server/app/routers/v3/connector.py.
  • Verify consistency of tracing/span/header handling and timeout usage across the three endpoints.
  • Confirm removed v2 tests' critical coverage (model substitution, error cases) is intentionally dropped or moved; ensure v3 tests cover required scenarios.

Possibly related PRs

Suggested reviewers

  • douenergy

Poem

🐇 A rabbit hops with joyful cheer,
New endpoints spring this time of year.
Tables, constraints, and versions show,
Old v2 tests gently go.
🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding v3 metadata API endpoints and removing v2 Oracle tests. It is concise, clear, and reflects the primary work in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75a98d2 and f42bf80.

📒 Files selected for processing (1)
  • ibis-server/tests/routers/v3/connector/oracle/test_query.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ibis-server/tests/routers/v3/connector/oracle/test_query.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
ibis-server/app/routers/v3/connector.py (1)

450-507: LGTM! Metadata endpoints properly implemented.

The three new v3 metadata endpoints follow the established patterns and are consistent with their v2 counterparts. The implementation correctly:

  • Uses appropriate FastAPI decorators and response models
  • Handles headers and connection info properly
  • Leverages MetadataFactory and timeout wrappers
  • Creates tracing spans for observability

Optional: Add tracing span to get_db_version for consistency.

The get_db_version endpoint (lines 494-507) doesn't create a tracing span, while get_table_list and get_constraints do. For consistency and better observability, consider adding a span:

 async def get_db_version(
     data_source: DataSource,
     dto: MetadataDTO,
     headers: Annotated[Headers, Depends(get_wren_headers)] = None,
 ) -> str:
+    span_name = f"v3_metadata_version_{data_source}"
+    with tracer.start_as_current_span(
+        name=span_name, kind=trace.SpanKind.SERVER, context=build_context(headers)
+    ) as span:
+        set_attribute(headers, span)
-    connection_info = data_source.get_connection_info(
-        dto.connection_info, dict(headers)
-    )
-    metadata = MetadataFactory.get_metadata(data_source, connection_info)
-    return await execute_get_version_with_timeout(metadata)
+        connection_info = data_source.get_connection_info(
+            dto.connection_info, dict(headers)
+        )
+        metadata = MetadataFactory.get_metadata(data_source, connection_info)
+        return await execute_get_version_with_timeout(metadata)

Note: This matches the current v2 behavior, so the inconsistency exists in both versions. This is purely an optional enhancement for uniformity.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 774e6fd and 75a98d2.

📒 Files selected for processing (3)
  • ibis-server/app/routers/v3/connector.py (3 hunks)
  • ibis-server/tests/routers/v2/connector/test_oracle.py (0 hunks)
  • ibis-server/tests/routers/v3/connector/oracle/test_query.py (1 hunks)
💤 Files with no reviewable changes (1)
  • ibis-server/tests/routers/v2/connector/test_oracle.py
🧰 Additional context used
🧬 Code graph analysis (2)
ibis-server/tests/routers/v3/connector/oracle/test_query.py (7)
ibis-server/tests/routers/v2/connector/test_local_file.py (4)
  • test_metadata_list_tables (186-213)
  • connection_info (85-89)
  • test_metadata_list_constraints (216-223)
  • test_metadata_db_version (226-234)
ibis-server/tests/routers/v2/connector/test_trino.py (3)
  • test_metadata_list_tables (274-319)
  • test_metadata_list_constraints (322-331)
  • test_metadata_db_version (334-341)
ibis-server/tests/routers/v2/connector/test_mysql.py (3)
  • test_metadata_list_tables (279-308)
  • test_metadata_list_constraints (311-325)
  • test_metadata_db_version (328-335)
ibis-server/tests/routers/v2/connector/test_snowflake.py (2)
  • test_metadata_list_tables (273-300)
  • test_metadata_list_constraints (303-311)
ibis-server/tests/routers/v2/connector/test_postgres.py (3)
  • test_metadata_list_tables (689-715)
  • test_metadata_list_constraints (718-724)
  • test_metadata_db_version (727-734)
ibis-server/tests/conftest.py (1)
  • client (18-23)
ibis-server/tests/routers/v3/connector/oracle/conftest.py (1)
  • connection_info (102-111)
ibis-server/app/routers/v3/connector.py (5)
ibis-server/app/model/metadata/dto.py (3)
  • Constraint (94-100)
  • MetadataDTO (9-10)
  • Table (80-85)
ibis-server/app/model/metadata/factory.py (2)
  • MetadataFactory (43-62)
  • get_metadata (45-62)
ibis-server/app/util.py (5)
  • execute_get_constraints_with_timeout (361-368)
  • execute_get_table_list_with_timeout (351-358)
  • execute_get_version_with_timeout (371-378)
  • build_context (142-145)
  • set_attribute (148-155)
ibis-server/app/routers/v2/connector.py (3)
  • get_table_list (259-273)
  • get_constraints (282-296)
  • get_db_version (304-313)
ibis-server/app/model/data_source.py (2)
  • DataSource (60-214)
  • get_connection_info (90-135)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: ci
🔇 Additional comments (3)
ibis-server/tests/routers/v3/connector/oracle/test_query.py (2)

263-290: LGTM! Comprehensive metadata table test.

The test properly validates the metadata response structure including table properties, columns, and specific column details. The assertions align with the expected Oracle metadata format and match patterns used in other datasource tests.


304-310: LGTM! Database version test is straightforward.

The test correctly validates that the Oracle database version endpoint returns a 200 status and contains the expected version string "23.0".

ibis-server/app/routers/v3/connector.py (1)

34-35: LGTM! Appropriate imports for metadata endpoints.

The new imports for metadata types (Constraint, MetadataDTO, Table, MetadataFactory) and timeout execution helpers are correctly added to support the new v3 metadata endpoints.

Also applies to: 44-46

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@goldmedal goldmedal marked this pull request as draft November 13, 2025 02:17
@goldmedal goldmedal closed this Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ibis python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant